//上液面检测,有水输出低电压，无水输出高电压

#ifndef _HEADER_WaterLine_H
#include "WaterLine.h"
#endif

WaterLine::WaterLine(/* args */)
{
}

WaterLine::~WaterLine()
{
}

void WaterLine::setPort(int port)
{
    this->port = port;
    pinMode(port,INPUT);
}

int WaterLine::getState()
{
    //检测状态
    this->state = analogRead(port);
    return state;
}

void WaterLine::toString(char* inStr)
{
    sprintf(inStr,"WaterLine:{port=%d,state=%d}",port,state);
}
